home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-02-27 | 4.0 KB | 83 lines | [TEXT/MPS ] |
- File #1: Roy G. Biv:C TCL patch ƒ:new files:CDecorator.c
- File #2: Roy G. Biv:C TCL patch ƒ:old files:CDecorator.c
-
- Nonmatching lines (File "Roy G. Biv:C TCL patch ƒ:new files:CDecorator.c"; Line 80:82; File "Roy G. Biv:C TCL patch ƒ:old files:CDecorator.c"; Line 80)
- 80 /* Altered by TCL Weaver version 1.0 (2/21/90) */
- 81
- 82 register WindowPeek macWPeek; /* Toolbox Window Record */
-
- 80 register GrafPtr macPort; /* Toolbox Graf Port */
-
-
- Nonmatching lines (File "Roy G. Biv:C TCL patch ƒ:new files:CDecorator.c"; Line 85:136; File "Roy G. Biv:C TCL patch ƒ:old files:CDecorator.c"; Line 83:96)
- 85 Rect structRect; /* Bounds of window's strucRgn */
- 86 Point portTopLeft; /* Top left of window's portRect */
- 87 GrafPtr savePort; /* Need to save and restore port */
- 88
- 89 /* Center the structure region of the window on the main */
- 90 /* screen, which is defined by screenBits.bounds. */
- 91
- 92 macWPeek = (WindowPeek) theWindow->GetMacPort();
- 93
- 94 /* strucRgn gives the overall size */
- 95 /* of a window */
- 96 if (theWindow->IsVisible()) {
- 97 structRect = (**(macWPeek->strucRgn)).rgnBBox;
- 98 }
- 99 else {
- 100 /* For invisible windows, the strucRgn is always empty. */
- 101 /* Thus, we have to fool the window manager by moving the */
- 102 /* window offscreen, showing it (it won't actually get */
- 103 /* drawn since it's offscreen), copying the bounds of the */
- 104 /* strucRgn, then hiding the window */
- 105
- 106 theWindow->MoveOffScreen();
- 107 ShowWindow(macWPeek);
- 108 structRect = (**(macWPeek->strucRgn)).rgnBBox;
- 109 HideWindow(macWPeek);
- 110 }
- 111
- 112 /* Now we need to get the top left corner of the portRect in */
- 113 /* global coords, since the strucRgn is in global coords. We */
- 114 /* want to know how far the portRect is inset from the strucRgn */
- 115 /* because the MoveWindow trap operates on the portRect, not the */
- 116 /* strucRgn. */
- 117
- 118 GetPort(&savePort);
- 119 SetPort(macWPeek);
- 120 portTopLeft = topLeft(((GrafPtr) macWPeek)->portRect);
- 121 LocalToGlobal(&portTopLeft);
- 122 SetPort(savePort);
- 123
- 124 /* Finally, we have all the necessary information. */
- 125
- 126 hPos = screenBits.bounds.left + portTopLeft.h - structRect.left +
- 127 ( (screenBits.bounds.right - screenBits.bounds.left) -
- 128 (structRect.right - structRect.left) ) / 2;
- 129
- 130 /* Vertically, we have to account for the menu bar. */
- 131
- 132 vPos = screenBits.bounds.top + GetMBarHeight() / 2 +
- 133 portTopLeft.v - structRect.top +
- 134 ( (screenBits.bounds.bottom - screenBits.bounds.top) -
- 135 (structRect.bottom - structRect.top) ) / 2;
- 136
-
- 83
- 84 /* Center the port rectangle of the window on the main screen, */
- 85 /* which is defined by screenBits.bounds. */
- 86
- 87 macPort = theWindow->GetMacPort();
- 88
- 89 hPos = screenBits.bounds.left +
- 90 ( (screenBits.bounds.right - screenBits.bounds.left) -
- 91 (macPort->portRect.right - macPort->portRect.left) ) / 2;
- 92
- 93 vPos = screenBits.bounds.top +
- 94 ( (screenBits.bounds.bottom - screenBits.bounds.top) -
- 95 (macPort->portRect.bottom - macPort->portRect.top) ) / 2;
- 96
-
-
- *** EOF on both files at the same time ***
-